﻿$(function () {
    var treeData = [{
        text: "登记信息",
        attributes: {
            url: "/Pages/RegisterPage.aspx"
        }
    }, {
        text: "QQ关联",
        attributes: {
            url: "/Pages/QQRelate.htm"
        }
    }, {
        text: "用户管理",
        attributes: {
            url: "/Pages/UserManage.aspx"
        }
    }, {
        text: "店铺管理",
        attributes: {
            url: "/Pages/ShopManager.htm"
        }
    }, {
        text: "项目管理",
        attributes: {
            url: "/Pages/ManagerPage.aspx"
        }
    }
];



    //实例化树菜单
    $("#tree").tree({
        data: treeData,
        lines: true,
        onClick: function (node) {
            if (node.attributes) {
                openTab(node.text, node.attributes.url);
            }
        }
    });

    //新增tab
    function openTab(text, url) {
        if ($("#tabs").tabs('exists', text)) {
            $("#tabs").tabs('select', text);
        } else {
            var content = "<iframe frameborder='0' scrolling='auto' style='width:100%;height:100%;' src=" + url + "></iframe>";
            $("#tabs").tabs('add', {
                title: text,
                closable: true,
                content: content
            });
        }
    }


    $('#tree').collapse('west');
});